<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ include file="/sys/include/header.jsp" %>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<title>修改店面信息</title>
<style type="text/css">
body{
	margin:10px;  
	font-size:0.9em;
}
a{
	color:#F00;
}
.STYLE1 {color: #FF0000}
</style>
<!-- extjs -->
<link rel="stylesheet" type="text/css" href="sys/extjs/css/ext-all.css">
<script type="text/javascript" src="sys/extjs/js/ext-base.js"></script>
<script type="text/javascript" src="sys/extjs/js/ext-all.js"></script>
<link rel="stylesheet" type="text/css" href="sys/extjs/css/tables-example.css">	
<link href="sys/style01/css/table.css" rel="stylesheet" type="text/css" /> 
<link rel="stylesheet" href="sys/style01/css/tab-view.css" type="text/css" media="screen">
<link href="sys/style01/date/css/banzu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="sys/style01/date/include/js/calendar.js"></script>
<script type="text/javascript" src="sys/style01/date/include/js/checkdate.js"></script>
<script type="text/javascript" src="sys/style01/date/include/js/calendar-zh.js"></script>
<script type="text/javascript" src="sys/style01/date/include/js/calendar-setup.js"></script>
</head>
<script type="text/javascript"> 
	var xmlhttp;
	var areaNow;
	function selectArea(areaCode,areaValue,area){
		areaNow = area;
		var url = "";
		if(areaCode==""){
			eval("document.form1."+areaNow+"_value.value=\"\"");
			return;
		}else
			eval("document.form1."+areaNow+"_value.value=\""+areaValue+"\"");
			 
		xmlHttp=createXml();
		if (xmlHttp==null) {
	    	alert ("您的浏览器不支持AJAX！");
	    	return;
	    }
	   
	    if(areaNow=='emp_area')
	  		url="hr/ajaxGetAreaList.action?queryAreaCode="+areaCode+"&sid="+Math.random();
	  	if(areaNow=='emp_province')
	  		url="hr/ajaxGetCityList.action?queryAreaCode="+areaCode+"&sid="+Math.random();
		if(areaNow=='emp_city')
	  		url="hr/ajaxGetCityLevel.action?queryCityCode="+areaCode+"&sid="+Math.random();
	 
	  	if(url!=""){
		  xmlHttp.onreadystatechange=areaChanged;
		  xmlHttp.open("GET",url,true);
		  xmlHttp.send(null);
	  }
	}
	
	function createXml(){
		var xmlhttpd;
		try{
			xmlhttpd= new ActiveXObject('msxml2.XMLHTTP');
		}catch(e){
			try{
				xmlhttpd=new ActiveXObject('Microsoft.XMLHTTP');
			}catch(e){
			 	try{
			 		xmlhttpd=new XMLHttpRequest();
				}catch(e){}
			}
		}
		return xmlhttpd;
	}
	
	//区域选择，ajax返回
	function areaChanged(){
		var provinceCode = new Array();
		var provinceValue = new Array();
		var cityLevel;
	 	if (xmlHttp.readyState == 4&&xmlHttp.status == 200){
	 	var xmlDoc = xmlHttp.responseXML.documentElement;
	 	//var str=xmlhttp.responseText;
	 	if (xmlDoc == null) {
			return;
		}
		var flagYn = true;
		var until = xmlDoc.childNodes;
		for (var idx=0; idx < until.length; idx++) {
			var peer = xmlDoc.childNodes[idx];
			if(areaNow=='emp_area'&&peer.tagName=='province'){
				provinceCode[provinceCode.length] = peer.text.split(",")[0];
			 	provinceValue[provinceValue.length] = peer.text.split(",")[1];
			 	continue;
			 }
			 
			 if(areaNow=='emp_province'&&peer.tagName=='city'){
				provinceCode[provinceCode.length] = peer.text.split(",")[0];
			 	provinceValue[provinceValue.length] = peer.text.split(",")[1];
			 	continue;
			 }
			 if(areaNow=='emp_city' && peer.tagName=='cityLevel'){
				 cityLevel = peer.text;
			}
		}			 
	
		
		if(areaNow=='emp_area'){
			if(provinceCode.length>0){
				document.form1.emp_province_code.innerHTML="";
				document.form1.emp_province_code.options[0]=new Option("请选择","");
				for(var i=0;i<provinceCode.length;i++)
					document.form1.emp_province_code.options[i+1]=new Option(provinceValue[i],provinceCode[i]);
				document.form1.emp_province_code.selectedIndex  = 0;
				document.form1.city_level.value="";
			}else{
				document.form1.emp_province_code.innerHTML="";
				document.form1.emp_province_code.options[0]=new Option("请选择","");
				document.form1.city_level.value="";
			}
			document.form1.emp_city_code.innerHTML="";
			document.form1.emp_city_code.options[0]=new Option("请选择","");
			document.form1.city_level.value="";
		}
		if(areaNow=='emp_province'){
			if(provinceCode.length>0){
				document.form1.emp_city_code.innerHTML="";
				document.form1.emp_city_code.options[0]=new Option("请选择","");
				document.form1.city_level.value="";
				for(var i=0;i<provinceCode.length;i++)
					document.form1.emp_city_code.options[i+1]=new Option(provinceValue[i],provinceCode[i]);
				document.form1.emp_city_code.selectedIndex  = 0;
			}else{
				document.form1.emp_city_code.innerHTML="";
				document.form1.emp_city_code.options[0]=new Option("请选择","");
				document.form1.city_level.value="";
			}
		}
		if(areaNow == 'emp_city'){
			document.form1.city_level.value = cityLevel;
		}
		areaNow = "";
		}
	}
	
	function save(){
		if(document.form1.emp_area_code.value==""){
			alert("请选择区域");
			return;
		}
		if(document.form1.emp_province_code.value==""){
			alert("请选择省份");
			return;
		}
		if(document.form1.emp_city_code.value==""){
			alert("请选择城市");
			return;
		}
		if(document.form1.shop_code.value==""){
			alert("请输入店面编号");
			return;
		}
		if(document.form1.shop_name.value==""){
			alert("请输入店面名称");
			return;
		}
		document.form1.submit();
    }

	function back()
	{
		document.form2.action = "hr/shopSearchDo.action";
		document.form2.submit();
	}

</script>
<body class="ridgeBody">
<table align="center" width="100%"><tr><td align="center">
<form name="form1" method="post" action="hr/shopModifyDo.action"  >
	<table class=datatable width="100%" cellpadding='0' cellspacing='0' border='1' bordercolordark='white' bordercolorlight='#BEBEBE'>
	    <tr>
	        <td height="25" colspan="4" valign="top" class="dataTitle"><br>店面信息</td>
	    </tr>	     
	    <tr>
	        <td height="22" with="25%" nowrap="nowrap" class="datatr1"><span class="STYLE1">*</span>区域：</td>
	        <td height="22" with="25%">
	        	<select class="selectwidth" name="emp_area_code" onChange="selectArea(this.options[selectedIndex].value,this.options[selectedIndex].text,'emp_area')"  value = "${shopBean.shop_area_code}" >
		            <option value="" selected>请选择</option>
		            <c:forEach items="${areaList}" var="area">
						<option value="${area.areaCode}" <c:if test="${area.areaCode==emp_area_code}">selected</c:if>>${area.areaValue} </option>	
					</c:forEach>
		        </select>
		        <input type="hidden" name="emp_area_value"/>
			</td>
			 <td height="22" with="25%" nowrap="nowrap" class="datatr1"><span class="STYLE1">*</span>省份：</td>
	        <td height="22" with="25%">
		        <select class="selectwidth" name="emp_province_code" value = "${shopBean.shop_province_code}" onChange="selectArea(this.options[selectedIndex].value,this.options[selectedIndex].text,'emp_province')"  >
		            <option value="" selected>请选择</option>
		            <c:forEach items="${provinceList}" var="province">
						<option value="${province.provinceCode}" <c:if test="${province.provinceCode==emp_province_code}">selected</c:if>>${province.provinceName}</option>	
					</c:forEach>
		        </select>
		        <input type="hidden" name="emp_province_value"/>
		    </td>
	    </tr>
        <tr>
       
           	<td height="22" with="25%" nowrap="nowrap" class="datatr1"><span class="STYLE1">*</span>城市：</td>
        	<td height="22" with="25%">
        		<select class="selectwidth" name="emp_city_code" value = "${shopBean.shop_city_code}" onChange="selectArea(this.options[selectedIndex].value,this.options[selectedIndex].text,'emp_city')">
            		<option value="" selected>请选择</option>
            		<c:forEach items="${cityList}" var="city">
						<option value="${city.cityCode}" <c:if test="${city.cityCode==emp_city_code}">selected</c:if>>${city.cityName}</option>	
					</c:forEach>
            	</select>
            	<input type="hidden" name="emp_city_value"/>
            </td>
            <td height="22" nowrap="nowrap" class="datatr1"><span class="STYLE1"></span>城市等级：</td>
        	<td height="22" >
        		<input name="city_level"  type="text" class="input"  value = "${cityLevel}" readonly/>
        	</td>
            
        </tr>
        <tr>      
        <td height="22" nowrap="nowrap" class="datatr1"><span class="STYLE1">*</span>店面编号：</td>
        	<td height="22" >
        		<input name="shop_code"  type="text" class="input"  value = "${shopBean.shop_code}"/>
        		<input name="shop_id"  type="hidden" class="input"  value = "${shopBean.shop_id}"/>
        	</td>  
        	<td height="22" nowrap="nowrap" class="datatr1"><span class="STYLE1">*</span>店面名称：</td>
        	<td height="22" >
        		<input name="shop_name"  type="text" class="input"  value = "${shopBean.shop_name}"/>
        	</td>
        	
        	
      </tr>
      <tr>    
      <td height="22" nowrap="nowrap" class="datatr1">店面等级：</td>
        	<td height="22" >
        	<input name="shop_level"  type="text" class="input"  value = "${shopBean.shop_level}"/>
       	    </td>    
        <td height="22" nowrap="nowrap" class="datatr1">负责督导：</td>
        <td height="22" >
        <input name="emp_ctm_id"  type="hidden" class="input" value = "${shopBean.shop_ctm_code}" readonly /> 
        	<input name="emp_ctm_name"  type="text" class="input" value = "${shopBean.shop_ctm_name}" readonly /> 
        	<span style="color:red;cursor:hand;textDecoration:underline" onclick="window.open('../hr/ctmListPop.action?emp_role=CTM','负责督导','height=400, width=600, top=400, left=600,scrollbars=yes')">查询</span> 
        </td>
            </tr> 
       <tr>   
         <td height="22" nowrap="nowrap" class="datatr1">卖场类型：</td>
        <td height="22" ><input name="shop_maichang_type"  type="text" class="input"  value = "${shopBean.shop_maichang_type}"/></td>
            
        <td height="22" nowrap="nowrap" class="datatr1">卖场编码：</td>
        <td height="22" nowrap >
        	<input name="shop_maichang_code"  type="text" class="input"  value = "${shopBean.shop_maichang_code}"/> 
        </td>
       
        </tr>
       <tr>
        <td height="22" nowrap="nowrap" class="datatr1">卖场名称：</td>
        <td height="22" nowrap >
        	<input name="shop_maichang_value"  type="text" class="input" value = "${shopBean.shop_maichang_value}" /> 
        </td>
        <td height="22" nowrap="nowrap" class="datatr1">店面类型：</td>
         <td height="22" nowrap >
        	<input name="shop_jingxiaoshang_type"  type="text" class="input" value = "${shopBean.shop_jingxiaoshang_type}" /> 
        </td>
        </tr>
        <tr>
         <td height="22" nowrap="nowrap" class="datatr1">经销商编码：</td>
        <td height="22" nowrap >
        	<input name="shop_jingxiaoshang_code"  type="text" class="input"  value = "${shopBean.shop_jingxiaoshang_code}"/> 
        </td>
         <td height="22" nowrap="nowrap" class="datatr1">品牌：</td>
        <td height="22" nowrap >
        	<input name="shop_brand"  type="text" class="input"  value = "${shopBean.shop_brand}"/> 
        </td>
        </tr>
     <tr>        
        <td height="22" nowrap="nowrap" class="datatr1">经销商名称：</td>
        <td height="22" nowrap >
        	<input name="shop_jingxiaoshang_value"  type="text" class="input" value = "${shopBean.shop_jingxiaoshang_value}" /> 
        </td>
        <td height="22" nowrap="nowrap" class="datatr1">邮编：</td>
        <td height="22" ><input name="shop_mail_code"  type="text" class="input"  value = "${shopBean.shop_mail_code}"/></td>  
      </tr>
     <tr>        
        <td height="22" nowrap="nowrap" class="datatr1">位置编码：</td>
        <td height="22" nowrap >
        	<input name="shop_position_code"  type="text" class="input"  value = "${shopBean.shop_position_code}"/> 
        </td>
         <td height="22" nowrap="nowrap" class="datatr1">详细地址：</td>
		 <td height="22"  colspan="3"><input name="shop_position_value"  type="text"  size="60" maxlength="500" value = "${shopBean.shop_position_value}"></td>         
       </tr>
</table>

<table width="100%" bgcolor="#96BDDA">
<tr>
<td height="20" colspan="6" valign="top" class="dataTitle"><input type="button"  onClick="save()" value="提交"><input type="button"  onClick="back()" value="返回"></td>

</tr> 
</table>
<input type="hidden" name="flag">
</form>
</td></tr></table>
<form name="form2" method="post" action=""  ></form>
</body>
</html> 

